[SPARK-46389][CORE] Manually close the RocksDB/LevelDB instance when checkVersion throw Exception#44327
Closed
LuciferYang wants to merge 1 commit intoapache:masterfrom
Closed
[SPARK-46389][CORE] Manually close the RocksDB/LevelDB instance when checkVersion throw Exception#44327LuciferYang wants to merge 1 commit intoapache:masterfrom
RocksDB/LevelDB instance when checkVersion throw Exception#44327LuciferYang wants to merge 1 commit intoapache:masterfrom
Conversation
LuciferYang
commented
Dec 13, 2023
| checkVersion(tmpDb, version, mapper); | ||
| try { | ||
| checkVersion(tmpDb, version, mapper); | ||
| } catch (IOException ioe) { |
Contributor
Author
There was a problem hiding this comment.
For LevelDB, it will only throw IOException.
LuciferYang
commented
Dec 13, 2023
| throw new IOException(e.getMessage(), e); | ||
| } catch (IOException ioe) { | ||
| tmpDb.close(); | ||
| throw ioe; |
Contributor
Author
There was a problem hiding this comment.
For RocksDB, it may throw either RocksDBException or IOException
Contributor
Author
|
friendly ping @dongjoon-hyun Could you help to review this if you have time, thanks ~ |
dongjoon-hyun
approved these changes
Dec 17, 2023
Member
dongjoon-hyun
left a comment
There was a problem hiding this comment.
+1, looks fine to me.
Sorry for the late reply, @LuciferYang .
Member
|
Merged to master. |
Contributor
Author
|
Thanks @dongjoon-hyun ~ |
FMX
pushed a commit
to apache/celeborn
that referenced
this pull request
Mar 8, 2024
…kVersion throw Exception ### What changes were proposed in this pull request? Should close the `RocksDB`/`LevelDB` instance when `checkVersion` throw Exception. Backport [[SPARK-46389][CORE] Manually close the RocksDB/LevelDB instance when checkVersion throw Exception](apache/spark#44327). ### Why are the changes needed? In the process of initializing the DB in `RocksDBProvider`/`LevelDBProvider`, there is a `checkVersion` step that may throw an exception. After the exception is thrown, the upper-level caller cannot hold the already opened RockDB/LevelDB instance, so it cannot perform resource cleanup, which poses a potential risk of handle leakage. So this PR manually closes the `RocksDB`/`LevelDB` instance when `checkVersion` throws an exception. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? CI. Closes #2369 from SteNicholas/CELEBORN-1315. Authored-by: SteNicholas <programgeek@163.com> Signed-off-by: mingji <fengmingxiao.fmx@alibaba-inc.com>
SteNicholas
added a commit
to apache/celeborn
that referenced
this pull request
Apr 23, 2024
…kVersion throw Exception ### What changes were proposed in this pull request? Should close the `RocksDB`/`LevelDB` instance when `checkVersion` throw Exception. Backport [[SPARK-46389][CORE] Manually close the RocksDB/LevelDB instance when checkVersion throw Exception](apache/spark#44327). ### Why are the changes needed? In the process of initializing the DB in `RocksDBProvider`/`LevelDBProvider`, there is a `checkVersion` step that may throw an exception. After the exception is thrown, the upper-level caller cannot hold the already opened RockDB/LevelDB instance, so it cannot perform resource cleanup, which poses a potential risk of handle leakage. So this PR manually closes the `RocksDB`/`LevelDB` instance when `checkVersion` throws an exception. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? CI. Closes #2369 from SteNicholas/CELEBORN-1315. Authored-by: SteNicholas <programgeek@163.com> Signed-off-by: mingji <fengmingxiao.fmx@alibaba-inc.com>
SteNicholas
added a commit
to apache/celeborn
that referenced
this pull request
Apr 23, 2024
…kVersion throw Exception ### What changes were proposed in this pull request? Should close the `RocksDB`/`LevelDB` instance when `checkVersion` throw Exception. Backport [[SPARK-46389][CORE] Manually close the RocksDB/LevelDB instance when checkVersion throw Exception](apache/spark#44327). ### Why are the changes needed? In the process of initializing the DB in `RocksDBProvider`/`LevelDBProvider`, there is a `checkVersion` step that may throw an exception. After the exception is thrown, the upper-level caller cannot hold the already opened RockDB/LevelDB instance, so it cannot perform resource cleanup, which poses a potential risk of handle leakage. So this PR manually closes the `RocksDB`/`LevelDB` instance when `checkVersion` throws an exception. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? CI. Closes #2369 from SteNicholas/CELEBORN-1315. Authored-by: SteNicholas <programgeek@163.com> Signed-off-by: mingji <fengmingxiao.fmx@alibaba-inc.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
In the process of initializing the
DBinRocksDBProvider/LevelDBProvider, there is acheckVersionstep that may throw an exception. After the exception is thrown, the upper-level caller cannot hold the already openedRockDB/LevelDBinstance, so it cannot perform resource cleanup, which poses a potential risk of handle leakage. So this PR manually closes theRocksDB/LevelDBinstance whencheckVersionthrows an exception.Why are the changes needed?
Should close the
RocksDB/LevelDBinstance whencheckVersionthrow ExceptionDoes this PR introduce any user-facing change?
No
How was this patch tested?
Pass GitHub Actions
Was this patch authored or co-authored using generative AI tooling?
No